import Vue from 'vue'
import Router from 'vue-router'




const Tabbar = () =>import('@/components/Tabbar');// /* webpackChunkName: "Tabbar" */
const tab_home = () => import( /* webpackChunkName: "tabbar-home" */ '@/pages/home.vue');
const tab_category = () => import(/* webpackChunkName: "tabbar-class" */ '@/pages/category.vue');
const tab_shoppingcart = () => import(/* webpackChunkName: "tabbar-class" */ '@/pages/shoppingcart.vue');
const tab_user = () => import(/* webpackChunkName: "tabbar-class" */ '@/pages/user.vue');


Vue.use(Router)

export default new Router({
  routes: [
    {
      path: "/",
      name: "home",
      components: {
        default: tab_home,
        tabbar: Tabbar,
      },
      meta: {
        keepAlive: true
      }
    },
    {
      path: '*',
      redirect: {
        name: 'home'
      }
    },
    // 分类
    {
      path: "/category",
      name: "category",
      meta: {
        keepAlive: true
      },
      components: { default: tab_category, tabbar: Tabbar }
      
    },
    //购物车
    {
      path: "/order",
      name: "cart",
      components: { default: tab_shoppingcart, tabbar: Tabbar }
    },

    //我的
    {
      path: "/user",
      name: "user",
      meta: {
        keepAlive: true
      },
      components: { default: tab_user, tabbar: Tabbar }
    }
  ]
})
